﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
using System.Data;

namespace DAL
{
     public class ZhangjieXiangqiDAL
    {
         //查询章节详情表
         public static List<ZhangjieXiangqi> Select()
         {
             string sql = "select * from ZhangjieXiangqi where FatherID is null";
             DataTable dt = DBHelper.Instance().GetDataTableBySql(sql);
             List<ZhangjieXiangqi> list = new List<ZhangjieXiangqi>();
             foreach (DataRow item in dt.Rows)
             {
                 ZhangjieXiangqi model = new ZhangjieXiangqi();
                 model.ZhangjieID = Convert.ToInt32(item["ZhangjieID"]);
                 model.Smallzhangjie = item["Smallzhangjie"].ToString();
                 list.Add(model);
             }
             return list;
         }
        //查询章节详情表带条件查询
         public static List<ZhangjieXiangqi> Allselect(string tiaojian)
         {
             string sql = "select * from ZhangjieXiangqi where "+tiaojian;
             DataTable dt = DBHelper.Instance().GetDataTableBySql(sql);
             List<ZhangjieXiangqi> list = new List<ZhangjieXiangqi>();
             foreach (DataRow item in dt.Rows)
             {
                 ZhangjieXiangqi model = new ZhangjieXiangqi();
                 model.ZhangjieID = Convert.ToInt32(item["ZhangjieID"]);
                 model.Smallzhangjie = item["Smallzhangjie"].ToString();
                 list.Add(model);
             }
             return list;
         }
    }
}
